package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025—04—22
 * Time: 17:42
 */
public class Demo9 {
    /**
     * 这种写法虽然严谨，但冗余度过高
     * @param args
     */
    public static void main(String[] args) {
        InputStream inputStream = null;
        try {
            // 此处隐含了一个操作，打开文件
            inputStream = new FileInputStream("./test.txt");

        }catch (IOException e) {
            e.printStackTrace();

        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
